package com.swt.controller;

import com.swt.common.vo.ResponseVo;
import com.swt.domain.Cart;


import com.swt.domain.RolePower;
import com.swt.service.RolePowerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Description
 * @Author swt
 * @Date 2022/5/17
 */
@RestController
@RequestMapping("/RolePower")
public class RolePowerController {
    @Autowired
    public RolePowerService rolePowerService;
    @GetMapping("/{count}/{size}")
    public ResponseVo pageRolePower(@PathVariable Integer count, @PathVariable Integer size){
        return ResponseVo.SUCCESS(rolePowerService.pagepower(count,size));

    }
    @DeleteMapping("/{id}")
    public ResponseVo deleteRolePower(@PathVariable String id){
        return rolePowerService.delectpower(id)>0?ResponseVo.SUCCESS:ResponseVo.FAIL;
    }
    @GetMapping("/{id}")
    public ResponseVo selectRolePowerById(@PathVariable String id){
        return ResponseVo.SUCCESS(rolePowerService.selectbypowerid(id));
    }
    @PostMapping
    public ResponseVo insertRolePower(@RequestBody RolePower s){
        return rolePowerService.inserpower(s)>0?ResponseVo.SUCCESS:ResponseVo.FAIL;
    }
    @PutMapping
    public ResponseVo updateRolePower(@RequestBody RolePower s){
        return rolePowerService.updatepower(s)>0?ResponseVo.SUCCESS:ResponseVo.FAIL;
    }
}

